local clsMessageInfo = Class( "lua/util/clsData.lua" ):Inherit()


function clsMessageInfo:New()
	self.message = {}		
	return self	
end		

function clsMessageInfo:update( data )
	self.message = data
end

function clsMessageInfo:closeInfo()
	local o = clsMessageInfo:getInstance()
	o = nil
end

function clsMessageInfo:add(key,cls,fun,data)
	local o = {}
	o["cls"] = cls
	o["fun"] = fun
	o["data"] = data
	if not self.message[key] then
		self.message[key] = {}
	end
	table.insert(self.message[key],o)		
end

function clsMessageInfo:front(key)
	if not self.message[key] or #self.message[key]== 0 then
		return nil
	end
	local temp = self.message[key]	
	local o = clone(temp[1])
	table.remove(temp,1)
	return o 
end

function clsMessageInfo:rear(key)
	if not self.meaasge[key] or #self.meaasge[key] == 0 then
		return nil
	end
	local temp = self.message[key]
	local o = clone(temp[#self.message[key]])
	table.remove(temp,#self.message[key])
	return o
end

function clsMessageInfo:getCount(key)
	if not self.message[key] then
		return 0
	end
	return #self.message[key]
end	

function clsMessageInfo:size()
	if not self.message then
		return 0
	end
	return #self.message
end

function clsMessageInfo:empty()
	if self:size() == 0 then
		return true
	end
	return false
end
function getClass()
	return clsMessageInfo
end